local legos = DongleStub("LegoBlock-Beta0")
local lego = legos:New('Legos','00:00')
Legos = DongleStub("Dongle-1.0"):New("Legos", lego)
local Legos = Legos

--local ClickTip = DongleStub("ClickTip-1.0")

local profile

function Legos:Initialize()
	self.defaults = {
		profile = {
			lego1 = {
				width = 150,
				height = 32,
				showText = true,
				showIcon = false,
				group = nil,
			},
			lego2 = {
				width = 150,
				height = 32,
				showText = true,
				showIcon = false,
				group = nil,
			},
			lego3 = {
				width = 150,
				height = 32,
				showText = true,
				showIcon = false,
				group = nil,
			},
			alarms = {},
		},
	}
	self:SetIcon("Interface\\Addons\\LegoBlock\\tests\\Legos.tga")
	self:CreateSlashCommands()
end

function Legos:Enable()
	self.db = self:InitializeDB("LegosDB", self.defaults)
	profile = self.db.profile
	lego:SetDB(profile.lego1)
	legos:New("ML1", "First Lego", nil, profile.lego2)
	legos:New("Ml2", "Second Lego", nil, profile.lego3)
end

function Legos:Disable()
end

function Legos:CreateSlashCommands()
	local cmd = self:InitializeSlashCommand("Legos slash commands", "Legos", "Legos", "wm")
	local function reset()
		self.db:ResetDB()
		self:SetDB(profile.lego)
	end
	cmd:RegisterSlashHandler("reset - Show configuration frame", "^reset$", reset)
end
